<template>
  <per :data="data" :num="2">
    <template #icon>
      <van-icon
        name="arrow-left"
        size="25"
        color="white"
        @click="ck"
      ></van-icon>
    </template>
  </per>
</template>

<script>
import Per from "@/components/Per.vue";
import { reactive } from "vue";
import { useRoute,useRouter } from "vue-router";
import store from "@/store"
export default {
  name: "Person",
  components: {
    Per,
  },
  setup() {
    let data = reactive({});
    const route = useRoute();
    const router = useRouter()
    // 获取路由传递过来的参数渲染页面
    data = JSON.parse(route.params.data);
    function ck() {
      // 点击返回 回到
      let data = store.state.detail
      data.num =1;
      data = JSON.stringify(data)
      router.push({name:"Detail",params:{msg:data}})
    }

    return {
      data,
      ck,
    };
  },
};
</script>

<style>
</style>